<?php

require_once './config.php';

$username = $_REQUEST['username'];

$sql = "SELECT * from cartinfo WHERE username = '$username'";

$result = mysqli_query($conn, $sql);

$list = array();

while($data = mysqli_fetch_assoc($result)) {
  $list[] = $data;
}

echo json_encode(array(
  'code' => 1,
  'data' => $list
));